<template>
  <div class="app-container">
    <el-row>
      <el-col :span="12">
        <div class="profit-item">
          <div class="profit-item-label">订单实付:</div>
          <div class="profit-item-val">{{actPrice}}</div>
        </div>
      </el-col>
      <el-col :span="12">
        <div class="profit-item">
          <div class="profit-item-label">总获利:</div>
          <div class="profit-item-val">{{orderProfit.totalProfit}}</div>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <div class="profit-item">
          <div class="profit-item-label">检测站获利:</div>
          <div class="profit-item-val">{{orderProfit.stationProfit}}</div>
        </div>
      </el-col>
      <el-col :span="12">
        <div class="profit-item">
          <div class="profit-item-label">司机获利:</div>
          <div class="profit-item-val">{{orderProfit.driverProfit}}</div>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <div class="profit-item">
          <div class="profit-item-label">推广人获利:</div>
          <div class="profit-item-val">{{orderProfit.agentProfit}}</div>
        </div>
      </el-col>
      <el-col :span="12">
        <div class="profit-item">
          <div class="profit-item-label">保险费:</div>
          <div class="profit-item-val">{{orderProfit.insureFee}}</div>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <div class="profit-item">
          <div class="profit-item-label">加盟商获利:</div>
          <div class="profit-item-val">{{orderProfit.stationAgentProfit}}</div>
        </div>
      </el-col>
      <el-col :span="12">
        <div class="profit-item">
          <div class="profit-item-label">平台获利:</div>
          <div class="profit-item-val">{{orderProfit.platProfit}}</div>
        </div>
      </el-col>
    </el-row>

    <el-row class="remark">
      <p>备注：</p>
      <p>1、订单获利情况以订单完成后数据为准，订单未完成时数据仅供参考</p>
      <p>2、下单时记录检测站获利</p>
      <p>3、如果是代驾订单，①订单成本包含保险费，②代驾司机抢单时记录代驾司机获利，改派司机时会重新计算司机获利</p>
      <p>4、只有订单完成时才计算订单总获利、推广人员获利、保险费、平台获利、加盟商获利情况</p>
      <p>5、总获利 = 订单实付金额 - 检测站分成 - 司机分成 - 推广人员分成 - 保险费</p>
      <p>6、平台获利</p>
      <p>&nbsp;&nbsp;&nbsp;&nbsp;6.1、平台获利：如果总获利为0或者负数，平台获利 = 总获利</p>
      <p>&nbsp;&nbsp;&nbsp;&nbsp;6.2、平台获利：按金额分成时，如果总获利小于加盟商设置的分成金额，平台获利 = 总获利</p>
      <p>&nbsp;&nbsp;&nbsp;&nbsp;6.3、平台获利：按金额分成时，如果总获利大于加盟商设置的分成金额，平台获利 = 加盟商设置的分成金额</p>
      <p>7、加盟商获利：（不允许出现负数）</p>
      <p>&nbsp;&nbsp;&nbsp;&nbsp;7.1、如果平台获利为0或者负数，加盟商获利为0</p>
      <p>&nbsp;&nbsp;&nbsp;&nbsp;7.2、如果平台获利大于0，加盟商获利 = 总获利 - 平台获利</p>
    </el-row>


  </div>
</template>

<script>
  import {getOrderProfit} from "@/api/order/order";


  export default {
    name: "Order",
    props: {
      orderId: {
        type: Number
      },
      actPrice: {
        type: Number
      }
    },
    data() {
      return {
        // 遮罩层
        loading: true,
        // 查询参数
        // 表单参数
        orderProfit: {},
      };
    },
    created() {
    },
    mounted() {
      this._getOrderProfit()
    },
    methods: {
      _getOrderProfit(){
        getOrderProfit(this.orderId).then(response => {
          if (response.code === 200) {
            this.orderProfit = response.data;
          } else {
            this.msgError(response.msg);
          }
        });
      },
    }
  };
</script>
<style>
  .profit-item{
    display: flex;
    margin: 20px 20px;
  }
  .profit-item-label{
    flex: 1;
    width: 110px;
    color: #1660d4;
    text-align: justify;
    text-justify: distribute-all-lines;
    text-align-last: justify;
  }
  .profit-item-val{
    flex: 1;
    border-bottom: 1px solid #e0dcdc;
    text-align: center;
  }
  .remark{
    color: red;
  }
</style>
